package com.lm.scau.framedemos;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.Toast;

import com.lm.scau.framedemos.Utils.StringUtil;
import com.lm.scau.framedemos.Views.LMTitleBar;

import butterknife.ButterKnife;

/**
 * Function:
 * auth：liming on 2016/5/24 09:36
 * mail：liming@wxchina.com
 */
public class BaseActivity extends AppCompatActivity {
    protected LMTitleBar mTitleBar;
    private ScauApplication mApplication;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if(null==mTitleBar){
            mTitleBar = new LMTitleBar(this);
        }
        mApplication = ScauApplication.getInstance();
        mApplication.addActivity(this);
    }

    protected void showToast(String msg) {
        if (StringUtil.isNotBlank(msg)) {
            Toast.makeText(this, msg, Toast.LENGTH_SHORT).show();
        }
    }

    protected void startActivity(Class target,Bundle bundle){
        Intent intent = new Intent(this,target);
        if(null!=bundle){
            intent.putExtras(bundle);
        }
        startActivity(intent);
    }

    public LMTitleBar getmTitleBar() {
        return mTitleBar;
    }

}
